home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Magnum One
/
Magnum One (Mid-American Digital) (Disc Manufacturing).iso
/
d11
/
nansi.arc
/
NANSI.PCH
< prev
next >
Wrap
Text File
|
1987-06-27
|
3KB
|
83 lines
This is a minimal patch to NANSI.ASM that will get rid of most flicker
on the IBM CGA or equivalent. Source lines in all caps are from
NANSI.ASM as distributed; lowercase lines are to be added. This goes,
as you can see, in F_T_NCTL (thanks for the tip, Seeds!). After
changing these lines (in a *copy* of NANSI.ASM), assemble and link as
follows:
MASM NANSI
MASM NANSI_P
MASM NANSI_F
MASM NANSI_I
(You'll need to have NANSI_D in the same directory as NANSI.ASM.
Ignore the error messages.)
LINK NANSI NANSI_P NANSI_F NANSI_I
(Ignore stack and error warnings.)
EXE2BIN NANSI NANSI.SYS
Copy NANSI.SYS to your boot disk/directory and add
DEVICE=NANSI.SYS
to your CONFIG.SYS file.
The patch works by examining the Display Status bit (bit 0) of the
status bite from video port 3DA. If the display is inactive, it might
be nearly ready to turn on; we wait for it to activate and deactivate
again before writing to the screen. Yes, it slows screen updates
slightly, but if you toggle raw mode on (using Chris Dunford's
RAW.COM), the delay is minimal.
There will occasionally be a slight bit of snow in the first column or
two of the screen. This seems to happen when screen updates are
synched with display activation/deactivation so the display turns on
just as the updating is taking place. One could add another loop to
wait for the display to turn off/on/off before writing, but the delay
would probably be noticable.
As I said, this is a minimal fix; a serious one would check video mode
to bypass all of this on the monochrome adaptor or EGA. DON'T USE THE
MODIFIED NANSI.SYS ON A MONOCHROME MACHINE!
F_T_NCTL:
SEG_CS
XLAT
; Patch starts here
push dx ;
push ax ; DX and AX get wiped out
mov dx,3DAh ; address of video status port
f_wait_for_on:
in al,dx ; get status
ror al,1h ; check display active bit
jc f_wait_for_on ; if inactive, loop
f_wait_for_off:
in al,dx ; get status
ror al,1h ; check display active bit
jnc f_wait_for_off ; if active, loop
pop ax ; get AX back
; This is from NANSI source ...
STOSW ; Put Char! (es:[di++] = ax)
; ...but this has to be added
pop dx ; get DX back for count
Note that this is *very* clock-cycle dependent; hence the use of RORs,
etc. In fact, an earlier version JCed to POP AX if the display was
inactive, but since it takes sixteen cycles to jump--as compared to
only four not to jump--the display would often become active during
the jump, and snow would appear in the left 1/3 of the screen. The
occasional snow in column 1 seems to result from display activation
during the consideration of the JNC or during the POP AX.